{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[5, 12], [21, 32]]\n"
     ]
    }
   ],
   "source": [
    "def hadadmrd_prod(M1, M2):\n",
    "    if(len(M1) != len(M2)) or (len(M1[0]) != len(M2[0])):\n",
    "        raise ValueError(\"Matrices must be of same size\")\n",
    "    return [[M1[i][j] * M2[i][j] for j in range(len(M1[0]))] for i in range(len(M1))]\n",
    "\n",
    "A = [[1, 2], [3,4]]\n",
    "B = [[5, 6], [7,8]]\n",
    "C = hadadmrd_prod(A, B)\n",
    "print(C)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
